<template>
  <div>
    <table>
      <tr>
        <th>欢迎光临</th>
      </tr>
      <tr>
        <td><h2>苹果十块打8折</h2></td>
      </tr>
      <tr>
        <input v-model="num" type="text">
      
      </tr>
      <tr><button @click="obj">结账</button></tr>
      <tr>总价: {{sum}}折后:{{last}} 节省: {{save}} </tr>
    </table>
  </div>
</template>

<script>
export default {
  name: 'FruitShopApp',

  data() {
    return {
     num:'',
     sum:'0',
     last:'0',
     save:'0'
    };
  },

  mounted() {
    
  },

  methods: {
   obj(){
     this.sum = this.num*10
     this.last = this.num*8
     this.save = this.num*10 - this.num*8
   }
  }
};
</script>

<style lang="scss" scoped>

</style>